<?php
// 本类由系统自动生成，仅供测试用途
namespace Qiaoxi\Controller;
use Think\Controller;
class FollowController extends Controller {
	public function index(){
		$this->display();
	}
	public function  login (){
		if (!IS_POST)
			$this->display();
		else
		{
			echo I('username').I('password');
		}
	}
	public function showDept()
	{
		$model=M('Department');
		
	}
	public function insert()
	{
		//这里由于数据库里的表名是c5_user，所以不能直接调用M('user'),https://blog.csdn.net/zhangzhangdan/article/details/78601919
		$model=M('','c5_User');
		for ($i=0;$i<=10000;$i++)
		{
			$data=array(
					'username'=>'zhangsan'.$i,
					'password'=>md5(microtime(true)),
					'create_at'=>time(),
					'updated_at'=>time(),
			);
			
			echo $model->add($data)?1:0,'<br/>';
		}
		echo 'ok';
	}
	public function listProperty()
	{
		$p=D('Property');
		$data=$p->query('SELECT e.EstateName,p.CountF+p.CountT+p.CountW+p.CountY AS hx ,p.Square,p.Price ,p.Floor 
		FROM Property p,Estate e WHERE p.EstateID=e.EstateID 
		ORDER BY p.ModDate DESC, p.LastFollowDate desc');
		$this->assign('data',$data);
		$this->display();
	}
}